$(document).ready(function(){
// TODO fix this horrible redraw hack
setTimeout(function(){$('#content, #results:visible, #results .pod:visible').css("display","block").css("display","");$(".bot").css("top","auto");},600);

/* preloading progress bars to solve IE parallel downloading issues */
image = new Image();
image.src = "/images/pod-loading.gif";

 /*
  $('#intro hr.bot').replaceWith('<b class="bot"></b>');
   $('#intro hr.top').replaceWith('<b class="top"></b>');
*/

$("#results:visible,#footer:visible,#sidebar:visible,#debug-wrapper:visible").css({"display":"block","left":"auto"});
$("#footer").css("left","-30px");
  /* IE is too dumb or too slow to focus when the text area appears, so we wait */
  $("#feedback input,#feedback fieldset span:first-child").one("focus keyup click",function(){setTimeout(function(){$("#feedback-textarea").focus();},100);});
  $(function(){$("#menu li:last-child").css("margin-top", "12px"); });

 // Force a redraw to prevent rendering errors
  //$("#results").bind("ajaxComplete ajaxStop",function(){$('#content, #results, #results .pod:visible').css("display","block").css("display","");});

  /* Asynch splat redraw */
  $(".recal-load .bot").css("display","block");

  $("#didYouMean ul li:last-child, #relatedInputs ul li:last-child").css("background-image","none");

/*
   $("body").ajaxStop(function(e){
      $("input").focus(function(e){$(this).siblings(".equal").css("background", "transparent url(/images/podSprite.png) no-repeat -501px -318px");}).blur(function(e){$(this).siblings(".equal").css("background","");
      });
   }); */

   // force redraw upon future topics form open
  $("#ftEmail,#ftSend").click(function(e){$("#results").css("display","").css("display","block");});

  // fix z-index problem with assumption dropdowns
  /*$(".menu").mouseover(function() {
    $("#sidebar").css("z-index", "0").css("z-index", "1");
    $(this).css("z-index", "0").css("z-index", "202");
  });
  $(".menu").mouseout(function() {
    $("#sidebar").css("z-index", "0").css("z-index", "1");
    $(this).css("z-index", "0").css("z-index", "202");
  });*/

  
});

function playSound( url ){
  if ( url ){
     $("#popanchor").append('<bgsound src="'+url+'" />');
  }
}
